package gl.view;

import android.os.CountDownTimer;
import android.widget.TextView;
/**
 * 将一个TextView 包装成 倒计时
 * @author geliang
 *
 */
public class CountDownTextView extends CountDownTimer {
	public TextView code;

	public CountDownTextView(TextView code, long millisInFuture,
			long countDownInterval) {
		super(millisInFuture, countDownInterval);
		this.code = code;
	}

	@Override
	public void onFinish() {
		code.setEnabled(true);
		code.setText("获取验证码");
	}

	@Override
	public void onTick(long millisUntilFinished) {
		code.setEnabled(false);
		code.setText("重新获取(" + millisUntilFinished / 1000 + ")秒");
	}

}